package org.spring.springlogger.controller;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactoryFriend;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j      // 自动生成名为 log 的 Logger 字段
@RestController
@RequestMapping("/logger")
public class LoggerController {

    private Logger logger = LoggerFactory.getLogger(LoggerController.class);

    @RequestMapping("/print")
    public String print(){
//        System.out.println("打印日志");
//
//        logger.info("打印日志");

        logger.trace("我是trace级别日志");
        logger.debug("我是debug级别日志");
        logger.info("我是info级别日志");
        logger.warn("我是warn级别日志");
        // logger.error("我是error级别日志");
        log.error("我是error级别日志");


        return "1";
    }

}
